package Lesson;

import java.util.Scanner;

public class UserLogIn {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String username = "admin";
        String password = "PRD912";

        for(int i = 1; i <= 3; i++){
            System.out.println("请输入用户名：");
            String userin = sc.nextLine();
            System.out.println("请输入密码：");
            String passwordin = sc.nextLine();
            if(userin.equals(username) && passwordin.equals(password)){
                System.out.println("欢迎您！");
                break;
            } else {

                if(i == 3){
                    System.out.println("还剩下"+(3-i)+"次机会。");
                }else{
                    System.out.println("输入错误，请重新输入！");
                }

            }
        }
        System.out.println("今日输入次数已用完，请明天再试。");
    }
}
